<template>
	<view class='newsDetail'>
		<view class='title'>{{title}}</view>
		<view class='list acea-row row-middle'>
			<view v-if="type == 1" class='label cart-color'>公告</view>
			<view v-else class='label cart-color'>新闻</view>
			<view class='item'><text class='iconfont icon-shenhezhong'></text>{{addTime}}</view>
			<view class='item'><text class='iconfont icon-liulan'></text>10000+</view>
		</view>
		<view class='conter'>
			<!-- <template is="wxParse" data="{{wxParseData:content.nodes}}" /> -->
			<u-parse :content="content" @preview="preview" @navigate="navigate"></u-parse>
		</view>
		<home></home>
	</view>
</template>

<script>
	import uParse from "@/components/feng-parse/parse.vue"
	import home from '@/components/home/home.vue'
	export default {
		data() {
			return {
				title: '公告详情',
				content: "",
				id: 0,
				addTime: "2019-01-01",
				type: 1
			}
		},
		components: {
			uParse,
			home
		},
		onLoad: function(options) {
			if (options.hasOwnProperty('id')) {
				this.id = options.id;
			} else {
				uni.navigateBack({
					delta: 1
				});
			}
		},
		onShow: function() {
			this.getArticleOne();
		},
		methods: {
			getArticleOne: function() {
				var that = this;
				that.$util.request(that.$api.api.ArticleDetail, {
					id: that.id
				}).then(function(res) {
					if (res.errno === 0) {
						console.log(res);
						that.title = res.data.title;
						that.content = res.data.content;
						that.addTime = res.data.addTime;
						that.type = res.data.type;

						that.content = res.data.content;
						//html转wxml
						//WxParse.wxParse('content', 'html', res.data.content, that, 0);
					}
				});
			},
		}
	}
</script>

<style>
	page {
		background-color: #fff !important;
	}

	.newsDetail .title {
		padding: 0 30rpx;
		font-size: 34rpx;
		color: #282828;
		font-weight: bold;
		margin: 45rpx 0 23rpx 0;
		line-height: 1.5;
	}

	.newsDetail .list {
		margin: 0 30rpx;
		border-bottom: 1rpx solid #eee;
		padding-bottom: 25rpx;
	}

	.newsDetail .list .label {
		font-size: 24rpx;
		height: 38rpx;
		border-radius: 3rpx;
		text-align: center;
		line-height: 38rpx;
		padding: 0 10rpx;
	}

	.newsDetail .list .item {
		margin-left: 27rpx;
		font-size: 24rpx;
		color: #999;
	}

	.newsDetail .list .item .iconfont {
		font-size: 28rpx;
		margin-right: 10rpx;
	}

	.newsDetail .list .item .iconfont.icon-shenhezhong {
		font-size: 26rpx;
	}

	.newsDetail .conter {
		padding: 0 15rpx;
		font-size: 30rpx;
		color: #333;
		line-height: 1.7;
		padding-top: 35rpx;
	}
</style>
